<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"  xmlns:c="http://java.sun.com/jsp/jstl/core"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:a4j="http://richfaces.org/a4j">
	<div id="container">
		<h:form>
			<div id="navi">
				<span>
					<h:graphicImage value="/resources/image/searchicon.jpg" alt="image" width="15" height="15"/>
					<a href="/assignment2" class="navi_button">Back to Entry</a>
				</span>
			</div>
			<div id="admin_s_option" >
				<div class="content_head">
					<span>Supplier Login</span>
				</div>
				<div class="content_body">
					<h:panelGrid columns="2">
						<h:outputText value="User Name:" />
						<h:inputText value="#{supplier.userName}" />
						<h:outputText value="Password:" />
						<h:inputSecret value="#{supplier.password}" />
					</h:panelGrid>
					<a4j:commandButton actionListener="#{supplier.search()}" value="Search" render="@form" />
				</div>
			</div>
			<div id="admin_content">
				<div class="content_head">
					<span>Purchase Information</span>
				</div>
				<div class="content_body">
					<rich:dataTable value="#{supplier.currentPurchases}" var="purchase" rendered="#{supplier.currentPurchases != null and !supplier.currentPurchases.isEmpty()}">
						<rich:column style="width: 10%">
							<f:facet name="header">
								Number
							</f:facet>
							<h:outputText value="#{purchase.number}" />
						</rich:column>
						<rich:column style="width: 20%">
							<f:facet name="header">
								Surname
							</f:facet>
							<h:outputText value="#{purchase.surname}" />
						</rich:column>
						<rich:column style="width: 20%">
							<f:facet name="header">
								Products Count
							</f:facet>
							<h:outputText value="#{purchase.productCount}" />
						</rich:column>
						<rich:column style="width: 20%">
							<f:facet name="header">
								Status
							</f:facet>
							<span>
								<h:outputText value="#{purchase.status}" />
								<a4j:commandButton value="Send" actionListener="#{supplier.send(purchase)}" render="@form" />
							</span>
						</rich:column>
						<rich:column style="width: 30%">
							<f:facet name="header">
								Total Price
							</f:facet>
							AU$ <h:outputText value="#{purchase.price}" />
						</rich:column>
					</rich:dataTable>
					<h:outputText value="There are no paid purchases found yet!" rendered="#{supplier.currentPurchases == null or supplier.currentPurchases.isEmpty()}" />
				</div>
			</div>
			<rich:notifyMessages />
		</h:form>
	</div>
</ui:composition>
